package com.itheima.day08_HomeWork;

import java.io.File;
import java.util.Scanner;

public class wenjian {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个文件路径：");
        String path = sc.nextLine();
        System.out.println("请输入要查找的文件名：");
        String fileName = sc.nextLine();
        File file = new File(path);
        File[] files = file.listFiles();
        for (File f1 : files) {
            if (f1.getName().equals(fileName)) {
                System.out.println(f1.getAbsolutePath() + " " + f1.length());
                return;
            } else {
                System.out.println("文件不存在");
            }

        }
    }
}

